GetUserRoles Method

Syntax

WindowsServices::ActiveDirectory::User::GetUserRoles as P (userId as C, ldapConnectionString as C, [connectionUserName as C], [connectionPassword as C], [attributeMapUsername as C], [additionalUserAttributes as C])

Arguments

userIdCharacter

The name of a user's attribute. The attribute name must be a name set on the WindowsServices::ActiveDirectory::Domain object's AdditionalUserAttributeNames or one of the property names on the WindowsServices::ActiveDirectory::User object such as "DistinguishedName".

ldapConnectionStringCharacter

The LDAP(S) connection string to test connecting to the Active Directory domain.

connectionUserNameCharacter

The userid for accessing Active Directory. Can be omitted or set to empty string '' if credentials are not needed to access Active Directory. Use an empty string if need to specify parameters after it.

connectionPasswordCharacter

The password for accessing Active Directory. Can be omitted or set to empty string '' if credentials are not needed to access Active Directory. Use an empty string if need to specify parameters after it.

attributeMapUsernameCharacter

The Active Directory attribute name to use for finding the user. Defaults to "sAMAccountName". Use "sAMAccountName" if need to include the following additionalUserAttributes argument.

AdditionalUserAttributeNamesCharacter

A crlf delimited list of attribute names not listed as properties in the WindowsServices::ActiveDirectory::User object.

Returns

resultP (an array of strings)

Returns an array of type C.

Description

This is a static method to get a user's roles without individually creating a WindowsServices::ActiveDirectory::Domain object and finding the user through it.

dim roles as p
roles = WindowsServices::ActiveDirectory::User::GetUserRoles("JohnDoe", ldapConnectionString, "ADUser", "ADUserPassword")
for each role in roles
?role + crlf()
next